<?php
/**
 * 具体中介者
 * Created by PhpStorm.
 * User: liangtiehui
 * Date: 2016/5/4
 * Time: 17:52
 */

namespace Meidator;


class ConcreteMediator implements Mediator
{
    private  $_orchardist = null; //果农
    private  $_boss = null; //化肥老板

    const FRUIT = "friut";
    const FERTILIZER = "fertilizer";

    public function sell($name, $number)
    {
        // TODO: Implement sell() method.
        if ($name == self::FRUIT) {
            $fruit = $this->_orchardist->getThings($number);
            echo '商场从果农给你' . $fruit . "!<br/>";
            return $fruit;
        }
        if($name == self::FERTILIZER) {
            $fertilizer = $this->_boss->getThings($number);
            echo '商场从化肥老板那里给你' . $fertilizer . "!<br/>";
            return $fertilizer;
        }
    }

    public function setOrchardist($orchardist)
    {
        $this->_orchardist = $orchardist;
    }

    public function setBoss($boss)
    {
        $this->_boss = $boss;
    }

}